# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer:
pkgname=ocaml-cmdliner
_pkgname=cmdliner
pkgver=1.1.1
pkgrel=2
pkgdesc="Declarative definition of command line interfaces for OCaml"
url="https://erratique.ch/software/cmdliner"
arch="all !riscv64"  # limited by ocaml aport
license="ISC"
depends="ocaml-runtime"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="ocaml"
options="!check"  # no tests provided
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.bz2::https://erratique.ch/software/cmdliner/releases/cmdliner-$pkgver.tbz"
builddir="$srcdir/$_pkgname-$pkgver"
_ocamldir=usr/lib/ocaml

# 32-bit archs
case "$CARCH" in
	arm*|x86) options="$options textrels" ;;
esac

build() {
	make -j1 all
}

package() {
	make DESTDIR="$pkgdir" install
	make DESTDIR="$pkgdir" install-doc
}

dev() {
	default_dev

	cd "$pkgdir"

	local path; for path in $(find $_ocamldir \( \
			-name '*.cmt' -o \
			-name '*.cmti' -o \
			-name '*.cmx' -o \
			-name '*.cmxa' -o \
			-name '*.ml' -o \
			-name '*.mli' \
		\))
	do
		amove "$path"
	done
}

sha512sums="
5478ad833da254b5587b3746e3a8493e66e867a081ac0f653a901cc8a7d944f66e4387592215ce25d939be76f281c4785702f54d4a74b1700bc8838a62255c9e  ocaml-cmdliner-1.1.1.tar.bz2
"
